<?php
/*
 * 我要直播
*/
namespace App\Validation;

use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\Numericality;

class LiveStartValidation extends BaseValidation
{
    public function initialize()
    {

		$this->add(
			"thumb",
			new PresenceOf(
				  [
					  "message" => "The thumb is required",
				  ]
			)
		);
		
		$this->add(
			"title",
			new PresenceOf(
				  [
					  "message" => "The title is required",
				  ]
			)
		);
		
		$this->add(
			"room_id",
			new Numericality(
				  [
					  "message" => ":field is not numeric",
				  ]
			)
		);

		$this->add(
			"video_id",
			new Numericality(
				  [
					  "message" => ":field is not numeric",
				  ]
			)
		);

		$this->add(
			"lon",
			new Numericality(
				  [
					  "message" => ":field is not numeric",
				  ]
			)
		);	

		$this->add(
			"lat",
			new Numericality(
				  [
					  "message" => ":field is not numeric",
				  ]
			)
		);

		$this->add(
			"address",
			new PresenceOf(
				  [
					  "message" => "The address is required",
				  ]
			)
		);
		
    }
	
	//验证之前
	public function beforeValidation($data, $entity, $messages)
    {
        
        return true;
    }
		
	
}